package com.bjpowernode.other.forkjoin;

import java.util.concurrent.ForkJoinPool;

public class ForkJoinTest {
    public static void main(String[] args) {
        ForkJoinPool forkJoinPool = new ForkJoinPool();

        //创建一个任务
        CountTask countTask = new CountTask(1L, 100L);

        //向线程池中提交任务
        Long num = forkJoinPool.invoke(countTask);

        System.out.println(num);//5050

        forkJoinPool.shutdown();
    }
}
